  $(function(){
		$("#addModule").click(function(){
			 var detail = $('#detail').val();
			 var kind = $('#kind').val();
			 var mainnewsModule = {"kind":kind, "detail":detail};
			  $.ajax({ 
                    type : "post",                                             
                    url : "addNewsModule",
                    dataType:"json", 
                    contentType:"application/json",
                    data:JSON.stringify(mainnewsModule),
                    success : function(data) {   	
				    alert(data.message);
				    var index = parent.layer.getFrameIndex(window.name);
				    window.parent.location.reload();
				    // 关闭当前frame
				    parent.layer.close(index);
                     
                       
                    },
                    error : function() {
                        alert("添加失败");
                    }
                });	
		});
		});
  
  $(function(){
		$("#editbtn").click(function(){
			 var detail = $('#detail').val();
			 var id = $('#id').val();
			 var mainnewsModule = {"id":id, "detail":detail};
			  $.ajax({ 
                  type : "post",                                             
                  url : "updateModule",
                  dataType:"json", 
                  contentType:"application/json",
                  data:JSON.stringify(mainnewsModule),
                  
                  success : function(data) {
                  	
				    alert(data.message);
				    var index = parent.layer.getFrameIndex(window.name);
				    window.parent.location.reload();
				    // 关闭当前frame
				    parent.layer.close(index);
                   
                     
                  },
                  error : function() {
                      alert("更新失败");
                  }
              });	
		});
		});
  $(function(){
		$("#addNews").click(function(){
			 var title = $('#title').val();
			 var firstClassify = $('#firstClassify option:selected').val();
			 var secondClassify = $('#secondClassify option:selected').val();
			 var imgUrl =$('#imgUrl').val();
			 var summary=$('#summary').val();
			 var detail =$('#editor').val();
			 var resource =$('#resource').val();
			 var mainnews = {"title":title ,"firstClassify":firstClassify,"secondClassify":secondClassify,"imgUrl":imgUrl,"summary":summary,"detail":detail,"resource":resource};
			 
			  $.ajax({ 
                type : "post",                                             
                url : "addNews",
                dataType:"json", 
                contentType:"application/json",
                data:JSON.stringify(mainnews),
                
                success : function(data) {
                	
				    alert(data.message);
				    var index = parent.layer.getFrameIndex(window.name);
				    window.parent.location.reload();
				    // 关闭当前frame
				    parent.layer.close(index);
                 
                   
                },
                error : function() {
                    alert("添加失败");
                }
            });	
		});
		});

  $(function(){
		$("#updateShufllingNews").click(function(){
			 var id =$('#id').val();
			 var title = $('#title').val();
			 var firstClassify = $('#firstClassify option:selected').val();
			 var secondClassify = $('#secondClassify option:selected').val();
			 var imgUrl =$('#imgUrl').val();
			 var summary=$('#summary').val();
			 var detail =$('#editor').val();
			 var resource=$('#resource').val();
			 
			 var mainnews = {"title":title ,"firstClassify":firstClassify,"secondClassify":secondClassify,"imgUrl":imgUrl,"summary":summary,"detail":detail,"id":id,"resource":resource};
			 
			  $.ajax({ 
            type : "post",                                             
            url : "updateShufllingNews",
            dataType:"json", 
            contentType:"application/json",
            data:JSON.stringify(mainnews),
            
            success : function(data) {
            	
				    alert(data.message);
				    var index = parent.layer.getFrameIndex(window.name);
				    window.parent.location.reload();
				    // 关闭当前frame
				    parent.layer.close(index);
             
               
            },
            error : function() {
                alert("添加失败");
            }
        });	
		});
		});

  
  $(function(){
		$("#updateNews").click(function(){
			 var id =$('#id').val();
			 var title = $('#title').val();
			 var firstClassify = $('#firstClassify option:selected').val();
			 var secondClassify = $('#secondClassify option:selected').val();
			 var imgUrl =$('#imgUrl').val();
			 var summary=$('#summary').val();
			 var detail =$('#editor').val();
			 var resource=$('#resource').val();
			 var mainnews = {"title":title ,"firstClassify":firstClassify,"secondClassify":secondClassify,"imgUrl":imgUrl,"summary":summary,"detail":detail,"id":id,"resource":resource};
			 
			  $.ajax({ 
              type : "post",                                             
              url : "updateNews",
              dataType:"json", 
              contentType:"application/json",
              data:JSON.stringify(mainnews),
              
              success : function(data) {
              	
				    alert(data.message);
				    var index = parent.layer.getFrameIndex(window.name);
				    window.parent.location.reload();
				    // 关闭当前frame
				    parent.layer.close(index);
               
                 
              },
              error : function() {
                  alert("添加失败");
              }
          });	
		});
		});
